class Solution
{
public:
    const int null = 0;
    const int full = 0xffffffff;
    int multiply(int A, int B)
    {
        if (!B)
            return 0;
        if (!(B & 1))
            return (A & null) + (multiply(A, B >> 1) << 1);
        else
            return (A & full) + (multiply(A, B >> 1) << 1);
    }
};